﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Ribbon_DDBigItem : UserControl
{
    private System.Collections.Generic.List<Control> _Items;

    [PersistenceMode(PersistenceMode.InnerProperty)]
    public System.Collections.Generic.List<Control> ContentTemplate
    {
        get { return _Items; }
        set { _Items = value; }
    }

    /// <summary>
    /// Sets or Gets the Text
    /// </summary>
    public string Text
    {
        get { return this.lb_text.Text; }
        set { this.lb_text.Text = value; }
    }

    /// <summary>
    /// Sets or Gets the icon url
    /// </summary>
    public string ImageUrl
    {
        get { return this.Image1.ImageUrl; }
        set { this.Image1.ImageUrl = value; }        
    }

    /// <summary>
    /// Sets the tooltip
    /// </summary>
    public string Tooltip
    {
        set { this.div_item.Attributes["title"] = value; }
    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (_Items != null)
        {
            foreach (Control obj in _Items)
            {
                this.PlaceHolder_menu.Controls.Add(obj);
            }
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        //onclick="_Ribbon_ShowMenu(this, '<%=this.div_menu.ClientID %>')"
        this.div_item.Attributes.Add("onclick", "SBRibbon.ShowMenu(this, '" + this.div_menu.ClientID + "')");
        this.div_menu.Attributes.Add("onmouseover", "SBRibbon.KeepMenu('" + this.div_menu.ClientID + "')");
        this.div_menu.Attributes.Add("onmouseout", "SBRibbon.HideMenu('" + this.div_menu.ClientID + "')");
        this.div_menu.Attributes.Add("MenuOpener", this.div_item.ClientID);
    }

}
